package com.winit.indexing.service;

import com.winit.indexing.model.Indexing;
import com.winit.indexing.model.IndexingId;

import java.util.List;

public interface IIdexingService {

    void indexing(Indexing indexing) throws Exception;

    /**
     * 该方法为强制移除方法，移除时会进行校验，如果不存在则会抛出异常
     * @param indexingId
     * @param referredIds
     * @throws Exception
     */
    void remove(IndexingId indexingId, String[] referredIds) throws Exception;

    /**
     * 该方法为存在则移除，若不存在，则不进行任何操作直接返回
     * @param indexingId
     * @param referredIds
     * @throws Exception
     */
    void removeIfExists(IndexingId indexingId, String[] referredIds);

    Indexing getIndexing(IndexingId indexingId);

    List<String> getFilterTag(String indexGroup);

    /**
     * 无效方法
     * @Deprecated
     * @param indexGroup
     * @return
     */
    List<Indexing> getFilterTagMap(String indexGroup);

    /**
     * 刷新indexing,先删除indexing(若存在)(参数indexing.indexingId指定)，再新建该indexing，支持新建indexingMap为空的记录
     *
     * @param indexing indexing.indexingId必须有效存在
     * @return 返回原有的indexing, 若IndexingId 不存在或者无效则返回null, 对应的indexing不存在也返回Null
     */
    Indexing reflushIndex(Indexing indexing);

    boolean deleteIndex(IndexingId indexingId);
}
